Skip to content

Forbid unnecessary type assertions#933

Merged
mfisher87 merged 2 commits intogeojupyter:mainfrom
mfisher87:lint-no-unnecessary-assertion
Sep 19, 2025
Merged

Forbid unnecessary type assertions#933
mfisher87 merged 2 commits intogeojupyter:mainfrom
mfisher87:lint-no-unnecessary-assertion

Conversation

@mfisher87
Copy link
Member

@mfisher87 mfisher87 commented Sep 18, 2025

Description

Keep our codebase a little more readable by removing unnecessary type assertions. Those type assertions may mislead readers to believe that a value is incorrectly typed (or potentially undefined) when it is not. It's easy to introduce unnecessary type assertions during development as we tighten up our type information.

Checklist

  • PR has a descriptive title and content.
  • PR description contains references to any issues the PR resolves, e.g. Resolves #XXX.
  • PR has one of the labels: documentation, bug, enhancement, feature, maintenance
  • Checks are passing.
    Failing lint checks can be resolved with:
    • pre-commit run --all-files
    • jlpm run lint

📚 Documentation preview: https://jupytergis--933.org.readthedocs.build/en/933/
💡 JupyterLite preview: https://jupytergis--933.org.readthedocs.build/en/933/lite

@mfisher87 mfisher87 added the maintenance Fixing lint errors, changing project metadata, changing tooling, changing dependencies, etc. label Sep 18, 2025
@github-actions
Copy link
Contributor

Binder 👈 Launch a Binder on branch mfisher87/jupytergis/lint-no-unnecessary-assertion

@mfisher87 mfisher87 force-pushed the lint-no-unnecessary-assertion branch from b926eb6 to 8d4c196 Compare September 18, 2025 17:38
@mfisher87 mfisher87 requested review from arjxn-py, gjmooney and martinRenou and removed request for arjxn-py and gjmooney September 18, 2025 17:39
@github-actions
Copy link
Contributor

github-actions bot commented Sep 18, 2025

Integration tests report: appsharing.space

},
plugins: ["@typescript-eslint", "import"],
rules: {
"@typescript-eslint/ban-ts-comment": "warn",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just satisfying my compulsive need to alphabetize here :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the idea with warning rules?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these are things that the team isn't fully committed to enforcing (yet). I'd like to upgrade them to errors, but I think we haven't have the time to fix the problems identified by the rule (yet). Perhaps we have a @ts-ignore we don't know how to eliminate (yet)?

@mfisher87 mfisher87 requested a review from stefanv September 18, 2025 19:42
Copy link
Collaborator

@stefanv stefanv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM!

I do notice that the eslint config is outdated. I just updated another project to 9, so if you are interested I can give the new flat config layout a shot.

@mfisher87
Copy link
Member Author

mfisher87 commented Sep 19, 2025

Thanks for the review!!

I do notice that the eslint config is outdated. I just updated another project to 9, so if you are interested I can give the new flat config layout a shot.

Love it, that'd be wonderful! I've been avoiding that pain for some time :)

@mfisher87 mfisher87 merged commit 8555031 into geojupyter:main Sep 19, 2025
15 checks passed
@mfisher87 mfisher87 deleted the lint-no-unnecessary-assertion branch September 19, 2025 17:44
@stefanv stefanv mentioned this pull request Sep 23, 2025
4 tasks
HaudinFlorence pushed a commit to HaudinFlorence/jupytergis that referenced this pull request Jan 28, 2026
* Forbid unnecessary type assertions

* Autofix lint errors and format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Fixing lint errors, changing project metadata, changing tooling, changing dependencies, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants